NetLogo banner

Home
Download
Help
Forum
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

Download
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

Try It in NetLogo Web

## WHAT IS IT?

This is a model of the fundamental law of population genetics, a.k.a. Hardy-Weinberg Equilibrium. The model is strictly adherent to the implicit and explicit assumptions originally made in 1908 by the English mathematician Godfrey Harold Hardy and the German physician Wilhelm Weinberg. These assumptions are summarized as follows:

* the organism is diploid;
* the considered gene is autosomal and bi-allelic (e.g., Brachydactyly);
* reproduction is sexual;
* generations are rigorously nonoverlapping;
* sexes are evenly distributed;
* the allele and genotypic frequencies are the same in males and females;
* mating is random (the population is panmictic);
* population size is very large (virtually infinite);
* migration is neglible;
* mutation can be ignored;
* natural selection does not affect the alleles under consideration.

Based on these assumptions, the simulation shows that equilibrium of genotype and allele frequencies is reached in one generation, and the population remains in equilibrium in successive generations. Verification of Hardy-Weinberg Equilibrium in the population is done with the Chi square test.

## HOW IT WORKS

Three agents' types with a "dot" shape - one for each genotype - are implemented as described hereafter:

1) white agents = "DD", homozygous genotype for the dominant phenotype;
2) red agents = "RR", homozygous genotype for the recessive phenotype;
3) green agents = "DR", heterozygous genotype, also correspondent to the dominant phenotype.

After fixing the initial number of individuals, each with a specific genotype, an equal number of males and females is assigned. Sex ratio is then maintained constantly = 1 throughout simulation. At the start of simulation, agents are arranged in a circle. The circular arrangement was chosen to facilitate visualization of random mating through the formation of links between agents of opposite sex. For each generation, each partner can only mate with a partner of opposite sex who is not engaged already in another mating event. After reproduction, the population of parents is completely replaced by the population of their offspring, which bears the specific genotypes predicted on the basis of Mendelian segregation rules. Over generations, population size remains constant Overlapping generations are never allowed because parents "die" at each generation after they have reproduced. The model uses a Chi square formula with correction for small sample size (i.e., expected values of genotypes < 5) (Hartl and Clark 2007).

## HOW TO USE IT

Use the sliders to select the initial number of agents with their specific genotypes. Press the setup button to arrange agents in a circle. Simulation consists of two steps to be performed in succession: first create-pairs, then reproduction. These steps are implemented with two buttons to run the simulation in a discrete mode. Alternatively, simulation can be run in a continuous mode by pressing the "go" (forever) button. Evolution of genotype and allele frequency can be followed by watching at the corresponding monitors and plots. Statistical differences between observed and expected number of each genotypic class is calculated, generation after generation, by the Chi square statistics, and Chi square values are reported in the corresponding monitor and plot. If population is in equilibrium chi square does not exceed the critical value which - for one degree of freedom - is = 3,84. This value is represented in the Chi square plot as a red line.

## THINGS TO NOTICE

Note that each generation is equivalent to two ticks, one tick for creating pairs and the subsequent one for reproduction.
Note also that, for expected values of genotypes too close to zero, the Chi square calculation is not reliable. Moreover, if a genotype is completely missing no Chi square value is calculated.

## THINGS TO TRY

Test the performance of the model with different initial numbers of the three genotypes.
Use the create-pairs and reproduction buttons to visualize the single steps of simulation (discrete mode). Alternatively, use the go button to observe the behaviour of the model run in continuous mode.

## EXTENDING THE MODEL

The code can be modified to test the effects of evolutionary forces (e.g., selection, mutations, etc.) on HWE.

## NETLOGO FEATURES

The two key primitive terms that were used to implement the mating and the reproduction procedures were "create-link-with" and "hatch" respectively. Furthermore, segregation ratios are stochastically implemented to assign the probabilities on Mendelian segregation ratios.

## RELATED MODELS

In the Netlogo Models Library look at (i) Hardy Weinberg Equilibrium, and (ii) Mendelian Inheritance.

## CREDITS AND REFERENCES

Hardy, G. H. (1908). Mendelian proportions in a mixed population. Science 28: 49-50.

Hartl, D. L., and Clark, A. G. (2007). Principles of Population Genetics (4th edition), Chapter 2 pp. 45-92. Sinauer.

Weinberg, W. (1908). Uber den Nachweis der Vererbung beim Menschen. Jahresh. Ver. Vaterl. Naturkd. Wurttemb 64: 369-382 (English translations in Boyer 1963 and Jameson 1977).

## HOW TO CITE

For the model itself:

Tarantino, R., and Romano, V. (2022). Hardy-Weinberg Basic Model.

University of Palermo, Italy

(back to the NetLogo User Community Models)